//
//  StoreEntity.m
//  SXH
//
//  Created by Jack on 15/12/16.
//  Copyright © 2015年 lyss. All rights reserved.
//

#import "StoreEntity.h"
#import "ProductEntity.h"

@implementation StoreEntity

- (instancetype)initWithAttributes:(NSDictionary *)attributes {
    
    self = [super init];
    if (!self) {
        return nil;
    }
    
    self.store_id= [attributes valueForKeyPath:@"store_id"];
    self.store_name = [attributes valueForKeyPath:@"store_name"];
    self.store_phone = [attributes valueForKeyPath:@"store_phone"];
    self.product_list = [[NSMutableArray alloc] init];
    
    NSArray *array = [attributes objectForKey:@"product_list"];
    for (NSDictionary* arr in array) {
        ProductEntity *productEntity = [[ProductEntity alloc] init];
        productEntity = [productEntity initWithAttributes:arr];
        [self.product_list addObject:productEntity];
    }
    
    return self;
}

@end
